﻿@model IEnumerable<vnMcdonald.Models.Product>

@{
    int i = 0;
}
@foreach (var item in Model)
{
    i = i + 1;
        <tr>
            <td class="text-center">@i</td>
            <td >
                @Html.DisplayFor(modelItem => item.Name)
                @Html.HiddenFor(modelItem => item.Name, new {id = item.CategoryId })
            </td>
            <td class="text-center">
                @Html.DisplayFor(modelItem => item.Price)
            </td>
            <td class="text-center">
                @Html.DisplayFor(modelItem => item.CreateDate).ToString().Substring(0, 10)
            </td>
            <td class="text-center" id="row-@item.ProductId">
                @if (item.IsActive == 1)
                {
                    @Ajax.ActionLink("Mở", "Update_Status_Products", new { id = item.ProductId }, new AjaxOptions { InsertionMode = InsertionMode.Replace, UpdateTargetId = "row-" + string.Format("{0}", item.ProductId) }, new {@class ="enable" })
                }
                else {
                    @Ajax.ActionLink("Đóng", "Update_Status_Products", new { id = item.ProductId }, new AjaxOptions { InsertionMode = InsertionMode.Replace, UpdateTargetId = "row-" + string.Format("{0}", item.ProductId) }, new {@class ="disable" })
                }
                
            </td>
            <td class="text-center">
                <a href="@Url.Action("ProductView","admin",new { id=item.ProductId })" title="Xem" class="view"><span>Xem</span></a>
                <a href="@Url.Action("ProductEdit","admin",new { id=item.ProductId })" title="Sửa" class="edit"><span>Sửa</span></a>
                @*@Ajax.ActionLink("Xóa", "Delete_Products", new { id = item.ProductId }, new AjaxOptions { InsertionMode = InsertionMode.Replace, UpdateTargetId = "reloadproduct" }, new {@class="delete" })*@
                <a href="@Url.Action("Delete_Products","admin",new { id=item.ProductId })" title="Xóa" rel="@item.ProductId" class="delete"><span>Xóa</span></a>
            </td>
        </tr>
}